package net.capgemini.bill.gaty.expressionarithmetique.web.ws.client;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.bill.audrey.expressionarithmetique.service.ExpressionArithmetiqueWebService;

/*import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.bill.audrey.expressionarithmetique.service.ExpressionArithmetiqueWebService;
*/

public class WsClientFactory {
public static <T> T   getClient(Class<T> clientClassInterface,String wsAdresse){
	 
  JaxWsProxyFactoryBean factory1 = new JaxWsProxyFactoryBean();
     factory1.setAddress(wsAdresse);
     factory1.setServiceClass(clientClassInterface);
     return (T) factory1.create(); 
 
}
public static <T> T   getClient(Class<T> clientClassInterface ){
	 
	return getClient(clientClassInterface, "http://localhost:8108/ExpressionArithmetiqueWebService/services/ws/expressionarithmetique");
}
 public static ExpressionArithmetiqueWebService  getClient( ){
	 
	return getClient(ExpressionArithmetiqueWebService.class, "http://localhost:8108/ExpressionArithmetiqueWebService/services/ws/expressionarithmetique");
} 
 public static ExpressionArithmetiqueWebService  getClient( String adresse)throws AddressCanNotBeNullException{
	 if(null==adresse)throw new AddressCanNotBeNullException();
	return getClient(ExpressionArithmetiqueWebService.class,adresse );//"http://localhost:8108/ExpressionArithmetiqueWebService/services/ws/expressionarithmetique");
} 
}
